package com.suixun.controller.credits;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.authority.controller.BaseManager;
import com.suixun.exception.OpServiceException;
import com.suixun.service.credits.HideEntranceService;
import com.suixun.util.Constant;

/**
 * <p>
 * Title: SendGoodsController
 * </p>
 * <p>
 * 功能描述: 积分入口配置
 * </p>
 * 
 * @author 陈显强
 * @date 2017年12月12日上午10:54:53
 * @version 1.0
 */
@RestController
@RequestMapping(value = "/credits/entrance")
public class EntranceController extends BaseManager {

	@Autowired
	private HideEntranceService hideEntranceService;

	/**
	 * 
	 * <p>
	 * Title: hideEntrance
	 * </p>
	 * <p>
	 * 功能描述: 隐藏积分入口
	 * </p>
	 * 
	 * @param sendGoodsForm
	 * @return
	 */
	@RequestMapping(value = "/hideEntrance.json")
	public Object hideEntrance(String uuid, Boolean guardianHide, Boolean teacherHide) {
		try {
			hideEntranceService.hideEntrance(uuid, guardianHide, teacherHide);
			return success();
		} catch (Exception e) {
			if (e instanceof OpServiceException) {
				return fail(e.getMessage());
			}
			logger("EntranceController hideEntrance:" + e.getMessage(), e);
			return fail(Constant.EXCEPTION.OPERATE_FAIL);
		}
	}

	/**
	 * <p>Title: getHideEntrances</p>
	 * <p> 功能描述: 获取积分入口</p>
	 * @param uuid
	 * @return
	 */
	@RequestMapping(value = "/getHideEntrances.json")
	public Object getHideEntrances(String uuid) {
		try {
			return success(hideEntranceService.getHideEntrances(uuid));
		} catch (Exception e) {
			logger("EntranceController getHideEntrances:" + e.getMessage(), e);
			return fail(Constant.EXCEPTION.OPERATE_FAIL);
		}
	}
}
